Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents | Next

Controlling Color

Video digitizer components support color digitization. Therefore, these components provide several functions that allow applications to control the color digitization process.

You can use VDSetInputColorSpaceMode in your application to enable and disable color digitization; you can use the VDGetInputColorSpaceMode function to determine whether color digitization is enabled. The VDUseThisCLUT function allows you to specify a color lookup table to be used by the video digitizer component. In cases where the component cannot accommodate a particular lookup table, your application can use the VDGetCLUTInUse function to retrieve the color lookup table used by the digitizer component.

Your application can determine whether a digitizer component supports color digitization by examining the input capability flags of the component. Specifically, if the digiInDoesColor flag is set to 1, the component supports color digitization. Applications can use the VDGetCurrentFlags function to obtain the input capability flags of a component (see "Getting Information About Video Digitizer Components" for more information).

Your application can determine a digitizer's supported pixel depths by calling the VDGetDMADepths function.

VDUseThisCLUT

Some video digitizer components allow applications to specify the lookup table for color digitization. Your application can set the color lookup table by calling the VDUseThisCLUT function.

pascal VideoDigitizerError VDUseThisCLUT
                                          (VideoDigitizerComponent ci,
                                          CTabHandle colorTableHandle);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
colorTableHandle
Contains a color table handle. The video digitizer component uses the color table referred to by this parameter.

DESCRIPTION

Applications can determine whether a digitizer component supports specified lookup tables by examining the digitizer component's output capability flags. Specifically, if the digiOutDoesILUT flag is set to 1, the digitizer component allows applications to specify color lookup tables. Applications can use the VDGetCurrentFlags function (described on VDGetCurrentFlags ) to obtain the input capability flags of a component.

This feature is only useful for capturing 8-bit color video.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

VDGetCLUTInUse

The VDGetCLUTInUse function allows an application to obtain the color lookup table used by a video digitizer component. By using the Palette Manager, the application can then set the destination so that it uses the same lookup table.

pascal VideoDigitizerError VDGetCLUTInUse
                                         (VideoDigitizerComponent ci,
                                          CTabHandle *colorTableHandle);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
colorTableHandle
Contains a pointer to a field that is to receive a color table handle. The video digitizer component returns a handle to its color lookup table. Applications can then set the destination to use this returned color table. Your application is responsible for disposing of this handle.

DESCRIPTION

In general, applications use this function only when a video digitizer component does not allow applications to specify lookup tables with the VDUseThisCLUT function. Applications can determine whether a digitizer component supports specified lookup tables by examining the component's output capability flags. Specifically, if the digiOutDoesILUT flag is set to 1, the digitizer component allows applications to specify color lookup tables. Applications can use the VDGetCurrentFlags function (described on VDGetCurrentFlags ) to obtain the input capability flags of a component.

RESULT CODES

noErr

0

No error

memFullErr

-108

Not enough room in heap zone

digiUnimpErr

-2201

Function not supported

VDSetInputColorSpaceMode

The VDSetInputColorSpaceMode function allows applications to choose between color and grayscale digitized video.

pascal VideoDigitizerError VDSetInputColorSpaceMode
                                          (VideoDigitizerComponent ci,
                                          short colorSpaceMode);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
colorSpaceMode
Controls color digitization. The following values are valid:
0
Grayscale digitization
1
Color digitization

DESCRIPTION

Applications can determine whether a digitizer component supports grayscale or color digitization by examining the digitizer component's input capability flags. Specifically, if the digiInDoesColor flag is set to 1, the digitizer component supports color digitization. Similarly, if the digiInDoesBW flag is set to 1, the digitizer component supports grayscale digitization. Applications can use the VDGetCurrentFlags function (described on VDGetCurrentFlags ) to obtain the input capability flags of a digitizer component.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

qtParamErr

-2202

Invalid parameter value

VDGetInputColorSpaceMode

The VDGetInputColorSpaceMode function allows applications to determine whether a digitizer is operating in color or grayscale mode.

pascal VideoDigitizerError VDGetInputColorSpaceMode
                                          (VideoDigitizerComponent ci,
                                         short *colorSpaceMode);
ci
Specifies the video digitizer component for the request. Applications obtain this reference from the Component Manager's OpenComponent function.
colorSpaceMode
Contains a pointer to a value that indicates whether the digitizer is operating in color or grayscale mode. The following values are valid:
0
Grayscale digitization
1
Color digitization

DESCRIPTION

Applications can determine whether a digitizer component supports grayscale or color digitization by examining the digitizer component's input capability flags. Specifically, if the digiInDoesColor flag is set to 1, the digitizer component supports color digitization. Similarly, if the digiInDoesBW flag is set to 1, the digitizer component supports grayscale digitization. Applications can use the VDGetCurrentFlags function (described on VDGetCurrentFlags ) to obtain the input capability flags of a digitizer component.

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported

qtParamErr

-2202

Invalid parameter value

SEE ALSO

Applications can choose between color and grayscale digitization by calling the VDSetInputColorSpaceMode function, which is described in the previous section.

VDGetDMADepths

The VDGetDMADepths function allows an application to determine which pixel depths a digitizer supports. This function is supported only by digitizers that support DMA (that is, their digiOutDoesDMA output capability flag is set to 1).

pascal VideoDigitizerError VDGetDMADepths
                                         (VideoDigitizerComponent ci,
                                          long *depthArray,
                                          long *preferredDepth);
ci
Identifies the application's connection to the video digitizer component. An application obtains this value from the Component Manager's OpenComponent function.
depthArray
Contains a pointer to a long integer. The video digitizer returns a value that indicates the depths it can support. Each depth is represented by a single bit in this field. More than one bit may be set to 1.
preferredDepth
Contains a pointer to a long integer. Video digitizers that have a preferred depth value return that value in this field, using one of the possible values of the depthArray parameter. Digitizers that do not prefer any given value set this field to 0.

DESCRIPTION

The flags returned by this function augment the information that an application can obtain from the digitizer's output capability flags in the digitizer information structure (see "Capability Flags," for more information). If a digitizer does not support this function but does support DMA, an application may assume that the digitizer can handle offscreen buffers at all of the depths indicated in its output capabilities flags.

Before a program that uses a video digitizer creates an offscreen buffer, it should call the VDGetDMADepths function to determine the pixel depths supported by the digitizer. If possible, the program should use the preferred depth, in order to obtain the best possible display performance.

Applications may use the following enumerators to set bits in the field referred to by the depthArray parameter.

enum {
    dmaDepth1           = 1,    /* supports black and white */
    dmaDepth2           = 2,    /* supports 2-bit color */
    dmaDepth4           = 4,    /* supports 4-bit color */
    dmaDepth8           = 8,    /* supports 8-bit color */
    dmaDepth16          = 16,   /* supports 16-bit color */
    dmaDepth32          = 32,   /* supports 32-bit color */
    dmaDepth2Gray       = 64,   /* supports 2-bit grayscale */
    dmaDepth4Gray       = 128,  /* supports 4-bit grayscale */
    dmaDepth8Gray       = 256   /* supports 8-bit grayscale */
};

RESULT CODES

noErr

0

No error

digiUnimpErr

-2201

Function not supported


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next